Skip to content

Don't lose occurrences when concurrent writers create a ticket - #744

Merged
RazerM merged 1 commit into
mainfrom
fix/sqlalchemy-ticket-race
Nov 10, 2026
Merged

RazerM merged 1 commit into
mainfrom
fix/sqlalchemy-ticket-race

Conversation

@RazerM

@RazerM RazerM commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

When two threads or processes logged from the same new call site at the same time, both could find no existing ticket and try to create one. The second insert failed on the unique record hash, and TicketingHandler lost that occurrence.

SQLAlchemyBackend now retries such a write once, in a new transaction, which finds the ticket the other writer created.

@RazerM
RazerM added this pull request to stack #745 November 9, 2026 23:25
@codspeed

codspeed Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 38 untouched benchmarks


Comparing fix/sqlalchemy-ticket-race (e7e861f) with main (44d326a)

Open in CodSpeed

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.76%. Comparing base (44d326a) to head (e7e861f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #744      +/-   ##
==========================================
+ Coverage   91.71%   91.76%   +0.05%     
==========================================
  Files          49       49              
  Lines        8103     8153      +50     
  Branches      619      622       +3     
==========================================
+ Hits         7432     7482      +50     
  Misses        538      538              
  Partials      133      133              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from fix/sqlalchemy-engine to main November 9, 2026 23:59
Two writers logging from the same new call site could both find no
ticket and both insert one. The second insert failed on the unique
record hash, and its occurrence was lost.
@RazerM
RazerM force-pushed the fix/sqlalchemy-ticket-race branch from e09b5d5 to e7e861f Compare November 9, 2026 23:59
@RazerM
RazerM merged commit baad5e2 into main Nov 10, 2026
52 checks passed
@RazerM
RazerM deleted the fix/sqlalchemy-ticket-race branch November 10, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant